$OpenBSD: patch-kdecore_kstandarddirs_cpp,v 1.5 2013/12/23 19:23:01 zhuk Exp $
--- kdecore/kstandarddirs.cpp.orig	Wed Feb 13 12:41:08 2008
+++ kdecore/kstandarddirs.cpp	Mon Dec 23 16:40:27 2013
@@ -274,10 +274,21 @@ bool KStandardDirs::addResourceType( const char *type,
     if (copy.at(copy.length() - 1) != '/')
 	copy += '/';
     if (!rels->contains(copy)) {
+        if (!priority)
+	    rels->append(copy);
+
+	// OpenBSD specifics: always add fallback directory for
+	// backward compatibility. Fallback should always be placed
+	// after "normal" dir.
+	QString datadef = kde_default("data");
+	if (copy.left(datadef.length()) == datadef) {
+	    QString fallback = "share/apps/" + copy.mid(datadef.length(), copy.length());
+	    kdDebug() << "Adding fallback OpenBSD resource for type " << type << ": " << fallback << endl;
+	    addResourceType(type, fallback, priority);
+	}
+
         if (priority)
 	    rels->prepend(copy);
-	else
-	    rels->append(copy);
 	dircache.remove(type); // clean the cache
 	return true;
     }
@@ -1019,13 +1030,13 @@ static int tokenize( QStringList& tokens, const QStrin
 
 QString KStandardDirs::kde_default(const char *type) {
     if (!strcmp(type, "data"))
-	return "share/apps/";
+	return "share/apps.kde3/";
     if (!strcmp(type, "html"))
-	return "share/doc/HTML/";
+	return "share/doc/HTML.kde3/";
     if (!strcmp(type, "icon"))
 	return "share/icons/";
     if (!strcmp(type, "config"))
-	return "share/config/";
+	return "share/config.kde3/";
     if (!strcmp(type, "pixmap"))
 	return "share/pixmaps/";
     if (!strcmp(type, "apps"))
@@ -1065,7 +1076,7 @@ QString KStandardDirs::kde_default(const char *type) {
     if (!strcmp(type, "xdgconf-menu"))
         return "menus/";
     if (!strcmp(type, "kcfg"))
-	return "share/config.kcfg";
+	return "share/config.kcfg.kde3";
     if (!strcmp(type, "emoticons"))
 			return "share/emoticons";
 
@@ -1423,6 +1434,12 @@ void KStandardDirs::addKDEDefaults()
 	addResourceType(types[index], kde_default(types[index]));
 	index++;
     }
+
+    // OpenBSD specific
+    addResourceType("config", "share/config", false);
+    addResourceType("data", "share/apps", false);
+    addResourceType("html", "share/doc/HTML", false);
+    addResourceType("kcfg", "share/config.kcfg", false);
 
     addResourceDir("home", QDir::homeDirPath());
 }
